<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ include file="/WEB-INF/views/public/main.jsp"%>
<ul>
	<li><a href="#">Authority</a></li>
</ul>
<div id="authorityModule" class="tab_padding">
<script type="text/javascript" src="${resourceUrl}/js/module_authority.js"></script>
	<h3>Manage Authorities</h3>
	<c:choose>
		<c:when test="${authorityList.size() > 0}">
			<table id="authorityModule_table" class="bordertable">
				<tr>
					<th>Authority</th>
					<th>Delete</th>
				</tr>
				<c:forEach var="authority" items="${authorityList}">
					<tr>
						<td>${authority.getName()}</td>
						<td> <a class="authorityModuleDelete" href="${rootUrl}secure/admin/authority/delete/$${authority.getId()}">Delete</a></td>
					</tr>
				</c:forEach>
			</table>
		</c:when>
		<c:otherwise>
			<p>No Authority added so far. Click ADD to add new Authority</p>
		</c:otherwise>
	</c:choose>
	<br/>
	<div id="authorityModule_add_dialog" class="dialog" title="Add new Authority">
		<form:form method="POST" id="authorityModule_add_form" action="${rootUrl}secure/admin/authority/add" commandName="authority" class="noEnterSubmit">
			<fieldset class="ui-helper-reset">
			 <table >
	  		  <tr>
	  		  	<td class="label"><label id="lname" for="name">Authority Name</label></td>
	  		  	<td><form:input path="name" id="name" size="25" class="required" minlength="3" ></form:input></td>
	  		  </tr>
	  		  </table>
			</fieldset>
		</form:form>
		<label id="authorityModule_add_dialog_status"></label>
	</div>	
	<div id="authorityModule_delete_dialog" class="dialog" title="Delete Authority">
			 <p>
			 Do you really want to delete the Authority of '<span id="authorityModule_delete_message"></span>' ?
			 </p>
			
		<label id="authorityModule_delete_dialog_status"></label>
	</div>
	<button id="authorityModule_add_button" class="customButton">Add Authority</button>			
</div>